home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / RBBSREG.SLT < prev    next >
Text File  |  1992-03-20  |  7KB  |  215 lines

  1. //-----------------------------------------------------------
  2. // RBBSREG.SL? Automatic registration to a new RBBS.
  3.  
  4. // Telix script for first logon to an RBBS system.
  5. // This script is normally called from the script RBBS.SLC.
  6. //
  7. // Please look at the comments through the whole file, and modify to
  8. // suit your needs, BEFORE you use it. Then recompile with CS RBBSREG. 
  9. //-----------------------------------------------------------
  10.  
  11. // If you have suggestions for improving this script, please suggest
  12. // improvements to me via old-fashioned snail-mail to:
  13.  
  14. // Author:  Inge Vabekk
  15. //          Hamangskogen 108
  16. //          N-1300 SANDVIKA
  17. //          NORWAY
  18. //          tel. (472) 546 396
  19.  
  20. str thisBBStype[]="RBBS"     // Works only for RBBS.
  21.    ,line       [80]          // Line for string storage.
  22.    ,temp        [4]          // Temporary for short strings.
  23.                              // For the Global storage:
  24.    ,global   []="GLOBAL"     // Global script.
  25.    ,bbstype  []="BTYPE"      // BBS type.
  26.    ,cprot    []="CPROT"      // Current protocol.
  27.    ,name     []="NAME"       // User name
  28.    ,addr     []="ADDR"       // Address
  29.    ,country  []="STATE"      // Country
  30.    ,mail     []="MAIL"       // Mail address
  31.    ,hfone    []="HTEL"       // Home phone
  32.    ,wfone    []="WTEL"       // Work phone
  33.    ,work     []="WORK"       // Profession
  34.    ,telver   []="TELVER"     // Telix version number
  35.    ,modem    []="MODEM"      // Type of modem
  36.    ,cpu      []="CPU"        // Type of CPU
  37.    ,passw    []="PASSW"      // Actual password
  38.    ;     
  39.  
  40. int tol = 300                // No activity for ½ minute
  41.    ,i, x                     // makes script time out.
  42.    ,stat, tmark
  43.    ;
  44.  
  45. //-----------------------------------------------------------
  46. // Script starts here.
  47. //-----------------------------------------------------------
  48.  
  49. main()
  50. {
  51. int l;
  52.  
  53.   entry();                               // Updates colors & status bar. 
  54.  
  55. // Only if online.
  56.  
  57.   if (!carrier())  
  58.   { failtone();
  59.     status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  60.     return (-1);
  61.   }
  62.  
  63.   read (bbstype,line);                   // Get current BBS type.
  64.   if (line != thisBBStype)  
  65.   { wrongBBS();                          // Doesn't match script!
  66.     return (-1);
  67.   }
  68.  
  69. // Wait for your own name.
  70.  
  71.   read (name,line);                      // Get user name.
  72.   if (!waitfor (line,3))                 // Wait 3 sec. for echo.
  73.     return (-1);                         // Incorrect.
  74.  
  75.   flush();
  76.   cputs ("Y^M");                         // Correct; answer Yes.
  77.  
  78.   if (!waitfor("CITY and COUNTRY?",3))   // Wait again.
  79.     return (-2);                         // Not received.
  80.  
  81. // Construct city and country, fx "SANDVIKA NORWAY".
  82.  
  83.   read (addr,line);                      // Get address.
  84.   l = strlen(line);
  85.   for (i=0; i<l; ++i)  
  86.   { if (subchr(line,l) > '9')            // Skip postal code
  87.       break;
  88.   }
  89.   for ( ; i<l; ++i)                      // Copy post-office name.
  90.     cputc (subchr (line,l));             // Send the rest.
  91.  
  92.   cputs (" ");
  93.   read (country,line);
  94.   cputs (line);                          // Echo city and country.
  95.   cputs ("^M");
  96.  
  97.   waitfor ("Key to continue",3);         // Wait again.
  98.   cputs ("^M");                         
  99.  
  100.   waitfor ("[R]egister?",3);             // Want to register?
  101.   cputs ("R^M");                         // Of course!
  102.  
  103.   waitfor ("use to logon again?",3);     // Wait for password request.
  104.  
  105.   read (passw,line);
  106.   for (i=0;i<2; ++i)                     // Password must be sent twice.
  107.   { cputs(line);             
  108.     cputs("^M");
  109.     if (i==0)
  110.     waitfor ("Verification (Dots Echo)?",3); // Verify password.
  111.   }
  112.  
  113.   waitfor ("present yourself now? (Y/N)?",3); // Present yourself.
  114.   cputs ("Y^M");
  115.  
  116.   waitfor ("voice phone number?",3);     // Voice phone
  117.   read (hfone,line);
  118.   cputs (line);
  119.   cputs ("^M");
  120.  
  121.   waitfor ("address (on one line please)",3); // Street address
  122.   read (addr,line);
  123.   cputs (line);
  124.   cputs ("^M");
  125.  
  126.   waitfor ("School do you go to?",3);    // School or work
  127.   read (work,line);
  128.   cputs (line);
  129.   cputs ("^M");
  130.  
  131.   waitfor ("(Type ^"N^" if nothing)",3);
  132.   cputs ("N^M");
  133.  
  134.   waitfor ("ll on one line, please)",3); // Modem and program
  135.   read (modem,line);
  136.   cputs (line);
  137.   cputs (", TELIX ver. ");
  138.   read (telver,line);
  139.   cputs (line);
  140.   cputs ("^M");
  141.  
  142.   waitfor ("system(s) do you use?",3);   // Computer system(s)
  143.   read (cpu,line);
  144.   cputs (line);
  145.   cputs ("^M");
  146.  
  147.   waitfor ("with your answers (Y/N)?",3);// Satisfied?
  148.   cputs ("Y^M");
  149.  
  150.   waitfor ("C)ontinuous,A)bort?",5);     // More?
  151.   cputs ("N^M");                         // No thanks.
  152.  
  153.   return(0);                             // Registration OK.         
  154. }
  155.                                          
  156. //-----------------------------------------------------------
  157. // Wrong BBS type.
  158. //-----------------------------------------------------------
  159.  
  160. wrongBBS()
  161. {
  162. str help[48];
  163.  
  164.     failtone();                          // Alarm.    
  165.     help = "This script is for ";        // Catenate strings.
  166.     strcat (help,thisBBStype);
  167.     strcat (help," only!");
  168.     status_wind (help,20);               // Display message for 2 sec.
  169. }
  170.  
  171. //-----------------------------------------------------------
  172. // Play fail tone.
  173. //-----------------------------------------------------------
  174.  
  175.  failtone()
  176. {
  177.   int n;
  178.   for (n=140; n > 10; n = 100*n/120) 
  179.   { tone(n*10,12);                       // Fail tone!!
  180.     terminal();                          // Process text.
  181.   }
  182. }
  183.                                         
  184. //-----------------------------------------------------------
  185. // Routine to update colors and status bar.
  186. //-----------------------------------------------------------
  187.  
  188. entry ()
  189. {
  190.   _back_color = 1;
  191.   _fore_color = 14;
  192.   update_term();
  193. }
  194.  
  195. //-----------------------------------------------------------
  196. // Read a global variable.
  197. //-----------------------------------------------------------
  198.  
  199. read (str name, str varname)
  200. {
  201.   return (call (global,"R",name,varname));
  202. }
  203.  
  204. //-----------------------------------------------------------
  205. // Flush incoming text from BBS.
  206. //-----------------------------------------------------------
  207.  
  208. flush()
  209. {
  210.   do
  211.   { terminal();                          // Process all echo
  212.     delay(1);                            // from the BBS.
  213.   } while (cinp_cnt() > 0);
  214. }
  215.